Skip to content

Fix startup crash: keep ShellViewModel.LoadAsync on the UI thread#10

Merged
StuartMeeks merged 1 commit into
masterfrom
fix/shell-loadasync-ui-thread
May 30, 2026
Merged

Fix startup crash: keep ShellViewModel.LoadAsync on the UI thread#10
StuartMeeks merged 1 commit into
masterfrom
fix/shell-loadasync-ui-thread

Conversation

@StuartMeeks

Copy link
Copy Markdown
Owner

Summary

  • ShellViewModel.LoadAsync used ConfigureAwait(false), so after _store.LoadAsync the continuation resumed on a thread-pool thread.
  • RebuildCliChoices() then mutated CliChoices — an ObservableCollection already bound to the CLI switcher — off the UI thread, which WinRT rejects with RPC_E_WRONG_THREAD (HRESULT 0x8001010E).
  • Switched to ConfigureAwait(true) and added a comment explaining why. CHANGELOG updated under the Fixed section.

Test plan

  • Core unit tests still pass (106/106).
  • First-run launch on Windows no longer throws at ShellPage.OnLoaded.

🤖 Generated with Claude Code

LoadAsync used ConfigureAwait(false), so after the store load the
continuation resumed on a thread-pool thread and RebuildCliChoices()
mutated CliChoices — an ObservableCollection already bound to the CLI
switcher — off the UI thread. WinRT rejects the cross-thread
collection-changed marshal with RPC_E_WRONG_THREAD (HRESULT 0x8001010E),
crashing the app at first launch.

Switch to ConfigureAwait(true) and document why.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@StuartMeeks StuartMeeks merged commit c946a20 into master May 30, 2026
4 checks passed
@StuartMeeks StuartMeeks deleted the fix/shell-loadasync-ui-thread branch May 30, 2026 00:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant